﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebHoiChoMuaBan.Controllers.Helpers;
using WebHoiChoMuaBan.Models;

namespace WebHoiChoMuaBan.Controllers
{
    public class ChatController : Controller
    {
        //
        // GET: /Chat/

        public ActionResult Index()
        {
            return View();
        }

        public void AddMsg()
        {
            if (null != Session["IsLogin"] && true == (bool)Session["IsLogin"])
            {
                int memId = (int)Session["MemId"];
                string msg = (string)Request.Params["chatmsg"];
                ChatHelper hChat = new ChatHelper();
                hChat.AddMsg(memId, msg);
            }
        }

        public void GetHistory()
        {
            ChatHelper hChat = new ChatHelper();
            string history = hChat.GetHistory();
            Response.Write(history);
        }
    }
}
